package com.xiaoye.qbproject.controller.qbtp;

import com.xiaoye.qbproject.controller.base.BaseController;
import com.xiaoye.qbproject.domain.AjaxResult;
import com.xiaoye.qbproject.service.RelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : ChenYao
 * @version : 1.0
 * @description : 图谱接口
 * @create : 2025-01-06 11:49
 */
@RestController
@RequestMapping("/relation")
public class RelationController extends BaseController {
    @Autowired
    private RelationService relationService;

    /**
     * @param entityName
     * @description: 获取情报图谱 实体详情
     * @author: ChenYao
     * @return: com.xiaoye.qbproject.domain.AjaxResult
     * @ceateDate: 2025-01-06 11:51
     */

    @GetMapping("/getQbRelation")
    public AjaxResult getQbRelation(@RequestParam(required = false) String entityName) {
        return success(relationService.getQbRelation(entityName));
    }

    /**
     * @param entityName
     * @description: 获取情报图谱 实体详情  有无关系都上图
     * @author: ChenYao
     * @return: com.xiaoye.qbproject.domain.AjaxResult
     * @ceateDate: 2025-01-06 16:04
     */

    @GetMapping("/getQbRelationAll")
    public AjaxResult getQbRelationAll(@RequestParam(required = false) String entityName) {
        return success(relationService.getQbRelationAll(entityName));
    }
    /**
     * 获取 国家 - 类型 -装备
     *
     * @param entityName 实体名称，非必需参数，若未提供则返回所有关系数据
     * @return AjaxResult 包含关系数据的Ajax结果对象
     */
    @GetMapping("/getQbRelationAll2")
     public AjaxResult getQbRelationAll2(@RequestParam(required = false) String entityName, String countryIds) {
        return success(relationService.getQbRelationAll2(entityName, countryIds));
    }

}
